@model Netnr.Func.ViewModel.DocTreeViewVM
@{
    ViewData["Title"] = Model.DsdTitle ?? "NetnrDoc";
}

<link href="/areas/doc/css/code/index.css" rel="stylesheet" asp-append-version="true" />
<partial name="_PartialQuote" model="@("netnrmd.css")" />

<div class="ndtv">
    <button type="button" class="MenuToggle show-in-mobile btn btn-primary my-3 mx-3 float-left">
        <span class="fa fa-align-justify fa-2x"></span>
    </button>
    <div class="ndtree">
        <partial name="_PartialDocTree" />
    </div>

    <div class="ndview">
        <!--右侧菜单-->
        <div class="ndvmenu">
            @{
                var uinfo = new UserAuthAid(ViewContext.HttpContext).Get();
            }
            @if (uinfo.UserId == 0)
            {
                <a href="/doc/discover" data-toggle="tooltip" data-placement="left" title="Doc">
                    <i class="fa fa-fw fa-lg fa-book text-success"></i>
                </a>
            }
            else
            {
                <a href="/doc/user/@uinfo.UserId" data-toggle="tooltip" data-placement="left" title="Your doc">
                    <i class="fa fa-fw fa-lg fa-book text-success"></i>
                </a>
            }
            @if (!string.IsNullOrWhiteSpace(Model.DsdId))
            {
                <a href="/doc/code/edit/@Model.DsCode?dsdid=@Model.DsdId" data-toggle="tooltip" data-placement="left" title="Edit">
                    <i class="fa fa-fw fa-lg fa-edit text-info"></i>
                </a>
                <a href="/doc/code/del/@Model.DsCode?dsdid=@Model.DsdId" data-toggle="tooltip" data-placement="left" title="Delete" onclick="return confirm('确定删除?')">
                    <i class="fa fa-fw fa-lg fa-trash text-danger"></i>
                </a>
            }
            <a target="_blank" href="/doc/code/export/@Model.DsCode" data-toggle="tooltip" data-placement="left" title="Export">
                <i class="fa fa-fw fa-lg fa-file-word-o text-primary"></i>
            </a>
            <a href="javascript:void(0)" id="switchsize" data-toggle="tooltip" data-placement="left" title="Switch size">
                <i class="fa fa-fw fa-lg fa-compress text-info"></i>
            </a>
        </div>

        <!--内容主体-->
        <div class="py-3">
            <partial name="_PartialDocTreeView" />
        </div>
    </div>
</div>
<script>
    SwitchSize(localStorage["doc_size_sm"] || 0);
    function SwitchSize(sm) {
        var icon = $('#switchsize').children();
        if (sm == 1) {
            icon.removeClass('fa-compress').addClass('fa-expand');
            $('#dtview').css('max-width', '800px');
        } else {
            icon.addClass('fa-compress').removeClass('fa-expand');
            $('#dtview').css('max-width', 'none');
        }
        localStorage["doc_size_sm"] = sm;
    }
    $('#switchsize').click(function () {
        SwitchSize($(this).children().hasClass('fa-compress') ? 1 : 0);
    });

    //提示
    $('.ndvmenu').children().tooltip()
</script>